<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>判断成绩等级</title>
</head>

<body>
    <script>
        var res = -1;

        // switch的值【值，数据类型】要与case的值【值、数据类型】匹配
        switch (true) {
            case (res >= 90 && res <= 100):
                console.log(res+'分评定为A');
                break;

            case (res >= 80 && res <= 89):
                console.log(res+'分评定为B');
                break;

            case (res >= 70 && res <= 79):
                console.log(res+'分评定为C');
                break;

            case (res >= 60 && res <= 69):
                console.log(res+'分评定为D');
                break;

            case (res < 60 && res >=0 ):
                console.log(res+'分评定为E');
                break;

            // 无效成绩(超过100、低于0)
            default:
                console.log(res + "分为无效成绩");
        }


        // 修改输出说明、增加无效成绩
    </script>
</body>

</html>